﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CSharp.Study.Algorithm
{
    public class 冒泡排序
    {
        public static void Go()
        {
            int[] arr = new int[] { 12, 3, 5, 7, 2, 33, 21, 26, 19 };

            for (int i = 0; i < arr.Length - 1; i++)
            {
                for (int j = 0; j < arr.Length - 1 - i; j++)
                {
                    if (arr[j] > arr[j + 1])
                    {
                        var num = arr[j];
                        arr[j] = arr[j + 1];
                        arr[j + 1] = num;
                    }
                }
            }
        }
    }
}
